﻿// Decompiled with JetBrains decompiler
// Type: Template.PartPoint
// Assembly: Template, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: A1AE1EF6-30A0-49FB-9D2D-B42DD776AA13
// Assembly location: C:\Users\KasimGulcan\Desktop\Kosgeb\DynaCAD\Project\DynaCAD\bin\Debug\Template.dll

using System;
using System.Windows;
using System.Windows.Media;
using System.Windows.Shapes;

namespace Template
{
  [Serializable]
  public class PartPoint
  {
    private int _PointNumber;
    private double _X;
    private double _Y;
    private bool _Active;
    [NonSerialized]
    public Path Ellipse;
    [NonSerialized]
    public Brush Color;

    public double X
    {
      get
      {
        return this._X;
      }
      set
      {
        this._X = value;
        ((EllipseGeometry) this.Ellipse.Data).Center = new Point(value, this._Y);
      }
    }

    public double Y
    {
      get
      {
        return this._Y;
      }
      set
      {
        this._Y = value;
        ((EllipseGeometry) this.Ellipse.Data).Center = new Point(this._X, value);
      }
    }

    public int PointNumber
    {
      get
      {
        return this._PointNumber;
      }
      set
      {
        this._PointNumber = value;
        if (value == 1)
          this.Color = (Brush) Brushes.Blue;
        else if (value == 2)
          this.Color = (Brush) Brushes.Red;
        else if (value == 3)
          this.Color = (Brush) Brushes.Green;
        else if (value == 4)
          this.Color = (Brush) Brushes.Yellow;
        this.Ellipse.Fill = this.Color;
        this.Ellipse.Stroke = (Brush) Brushes.Black;
        this.Ellipse.StrokeThickness = 0.2;
          
        this.Ellipse.Opacity = 0.8;
      }
    }

    public bool Aktive
    {
      get
      {
        return this._Active;
      }
      set
      {
        this._Active = value;
        if (value)
        {
          this.Ellipse.Fill = this.Color;
          this.Ellipse.Visibility = Visibility.Visible;
        }
        else
        {
          this.Ellipse.Fill = (Brush) Brushes.Gray;
          this.Ellipse.Visibility = Visibility.Collapsed;
        }
      }
    }

    public PartPoint(double X, double Y, int Number)
    {
      this.Ellipse = new Path();
      EllipseGeometry ellipseGeometry = new EllipseGeometry();
      this.Ellipse.Data = (Geometry) ellipseGeometry;
      ellipseGeometry.RadiusX = 5.0;
      ellipseGeometry.RadiusY = 5.0;
      this.X = X;
      this.Y = Y;
      this.PointNumber = Number;
      this.Aktive = true;
    }

    public void UpdatePartPoint()
    {
      this._X = ((EllipseGeometry) this.Ellipse.Data).Center.X;
      this._Y = ((EllipseGeometry) this.Ellipse.Data).Center.Y;
      this.PointNumber = this._PointNumber;
    }

    public void DrivePoint()
    {
      this.Ellipse = new Path();
      EllipseGeometry ellipseGeometry = new EllipseGeometry();
      this.Ellipse.Data = (Geometry) ellipseGeometry;
      ellipseGeometry.RadiusX = 5.0;
      ellipseGeometry.RadiusY = 5.0;
      this.X = this._X;
      this.Y = this._Y;
      this.PointNumber = this._PointNumber;
    }
  }
}
